package com.dm.cloud.images.mapper;

import com.dm.cloud.tkmybatis.service.BaseMapper;
import com.dm.cloud.images.common.po.ImagesAppTask;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
   * @author hcx
   * @type ImagesAppTaskMapper.java
   * @desc ImagesAppTask mapper
   */

@Mapper
public interface ImagesAppTaskMapper extends BaseMapper<ImagesAppTask> {

    @Select("select * from T_IMAGES_APP_TASK where app_code=#{appCode}")
    ImagesAppTask findByAppCode(@Param("appCode") String appCode);

    @Select("select count(1) from T_IMAGES_APP_TASK where status=1")
    int findRunTaskSize();

    @Select("select * from T_IMAGES_APP_TASK where status=0 limit 1")
    ImagesAppTask findNoStartLimit1();
    @Select("select * from T_IMAGES_APP_TASK where service_id=#{serviceId} and status<>2")
    List<ImagesAppTask> findByServiceId(@Param("serviceId") String serviceId);
    @Update("update T_IMAGES_APP_TASK set status=#{status},tp=#{tp},service_id=#{serviceId} where id=#{id}")
    int updateTaskParamById(int status, int tp, String serviceId,String id);
}
